{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "tags": [
     "notebook-header"
    ]
   },
   "source": [
    "[![GitHub issues by-label](https://img.shields.io/github/issues-raw/pfebrer/sisl/SitesPlot?style=for-the-badge)](https://github.com/pfebrer/sisl/labels/SitesPlot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n",
    "    \n",
    "SitesPlot\n",
    "=========\n",
    "\n",
    "The `SitesPlot` is simply an adaptation of `GeometryPlot`'s machinery to any class that can be represented as sites in space. The main difference is that it doesn't show bonds, and also inputs with the word `atoms` are renamed to `sites`. Therefore, see `GeometryPlot`'s showcase notebook to understand the full customization possibilities.\n",
    "\n",
    "We are just going to show how you can plot the k points of a `BrillouinZone` object with it."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sisl\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's create a circle of K points:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "g = sisl.geom.graphene()\n",
    "\n",
    "# Create the circle\n",
    "bz = sisl.BrillouinZone.param_circle(\n",
    "    g, kR=0.0085, origin=[0.0, 0.0, 0.0], normal=[0.0, 0.0, 1.0], N_or_dk=25, loop=True\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And then generate some fake vectorial data for it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = np.zeros((len(bz), 3))\n",
    "\n",
    "data[:, 0] = -bz.k[:, 1]\n",
    "data[:, 1] = bz.k[:, 0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And now plot the k points, showing the vectorial data as arrows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "nbsphinx-thumbnail"
    ]
   },
   "outputs": [],
   "source": [
    "# Plot k points as sites\n",
    "bz.plot.sites(\n",
    "    axes=\"xy\",\n",
    "    drawing_mode=\"line\",\n",
    "    sites_style={\"color\": \"black\", \"size\": 2},\n",
    "    arrows={\"data\": data, \"color\": \"red\", \"width\": 3, \"name\": \"Force\"},\n",
    ").show(\"png\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
